package com.example.bes012.multiple.ds.demo.config;

import com.bes.enterprise.jdbc.spring.boot.autoconfigure.BesDataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class DataSourceConfig {

    @Bean(value = "dataSource1")
    @ConfigurationProperties(prefix = "spring.datasource.db1")
    public DataSource dataSource() {
        return BesDataSourceBuilder.create().build();
    }

    @Bean(value = "dataSource2")
    @ConfigurationProperties(prefix = "spring.datasource.db2")
    public DataSource dataSource2() {
        return BesDataSourceBuilder.create().build();
    }

}
